package edu.cmu.aes.project1.app2;
import java.util.Scanner;

import javax.xml.xquery.XQConnection;
import javax.xml.xquery.XQDataSource;
import javax.xml.xquery.XQException;
import javax.xml.xquery.XQExpression;
import javax.xml.xquery.XQResultSequence;

import net.sf.saxon.xqj.SaxonXQDataSource;

/**
 * This Class contains the collection of objects required for executing XQuery
 * queries and commands
 * 
 * @author Prasanna
 * 
 */
public class XQueryUtils {
	private Scanner input;
	/**
	 * @return the input
	 */
	public Scanner getInput() {
		return input;
	}

	/**
	 * @param input the input to set
	 */
	public void setInput(Scanner input) {
		this.input = input;
	}

	/**
	 * @return the conn
	 */
	public XQConnection getConn() {
		return conn;
	}

	/**
	 * @param conn the conn to set
	 */
	public void setConn(XQConnection conn) {
		this.conn = conn;
	}

	/**
	 * @return the expr
	 */
	public XQExpression getExpr() {
		return expr;
	}

	/**
	 * @param expr the expr to set
	 */
	public void setExpr(XQExpression expr) {
		this.expr = expr;
	}

	/**
	 * @return the result
	 */
	public XQResultSequence getResult() {
		return result;
	}

	/**
	 * @param result the result to set
	 */
	public void setResult(XQResultSequence result) {
		this.result = result;
	}

	/**
	 * @return the ds
	 */
	public XQDataSource getDs() {
		return ds;
	}

	/**
	 * @param ds the ds to set
	 */
	public void setDs(XQDataSource ds) {
		this.ds = ds;
	}

	private XQConnection conn;
	private XQExpression expr;
	private XQResultSequence result;
	private XQDataSource ds;

	public XQueryUtils() throws XQException {
		input = new Scanner(System.in);
		ds = new SaxonXQDataSource();
		conn = ds.getConnection();
		expr = conn.createExpression();
	}

}